import { getToken } from '@/utils/auth'
import { RouteRecordRaw } from 'vue-router'
import MenuJson from './menu.json'
const token = getToken()

// 组件导入辅助函数
const getComponent = (path: string) => {
  console.log(`@/views/${path}.vue`)

  return () => import(`@/views/${path}.vue`)
}

// 模拟菜单数据
export const mockMenus: RouteRecordRaw[] = MenuJson as any[]

// 模拟按钮权限数据
export const mockButtonPermissions: Record<string, string[]> = {
  admin: ['user:add', 'user:edit', 'user:delete', 'user:view', 'dashboard:view', 'dashboard:edit'],
  user: ['user:view', 'dashboard:view'],
}

// 模拟获取菜单列表
export const getMockMenuList = () => {
  return Promise.resolve({
    data: mockMenus,
  })
}

// 模拟获取按钮权限
export const getMockButtonPermissions = (role: string) => {
  return Promise.resolve({
    data: mockButtonPermissions[role] || [],
  })
}
